﻿@using Microsoft.AspNetCore.Identity
@using BlondeHeaven.Models
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@inject RoleManager<IdentityRole> RoleManager

@if (SignInManager.IsSignedIn(User))
{
    <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
        <ul class="nav navbar-nav navbar-right">


            @if (User.IsInRole("Admin"))
            {
                <li><a class="nav-link text-dark" asp-area="" asp-controller="User" asp-action="Index">用户管理</a></li>
                <li> <a class="nav-link text-dark" asp-area="" asp-controller="Role" asp-action="Index">角色管理</a></li>
            }
            @if (User.IsInRole("AdminShop"))
            {
                <li> <a class="nav-link text-dark" asp-area="" asp-controller="Personal" asp-action="MyShop">店主中心</a></li>
            }
            <li> <a class="nav-link text-dark" asp-area="" asp-controller="Personal" asp-action="Index">个人中心</a></li>
            <li>
                <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
            </li>

            <li>
                <button type="submit" class="btn btn-link navbar-btn navbar-link">Logout</button>
            </li>
        </ul>
    </form>
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li><a asp-controller="User" asp-action="AddUser">注册</a></li>
        <li><a asp-controller="User" asp-action="Login">登入</a></li>
    </ul>
}
